package com.woniuxy01;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author 作者
 * @create 2025-07-25 9:38
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
public class Student implements Comparable{
    private String name;
    private int age;
    private double score;


    @Override
    public int compareTo(Object o) {
        //年龄升序  年龄降序排 姓名升序 姓名降序
        if(o instanceof Student){
            Student that = (Student)o;
            return this.age - that.age;
        }
        return 1;
    }
}



